package com.my.study.utils;

import java.net.URLEncoder;

/**
 * @author luyuhao
 * @since 2020/8/25 20:59
 */
public class TokenUtil {

    private static final String KEY = "FB50C865";

    public static String genertateNewToken(String username, String showName, String role, String dept) throws Exception {
        String jumpUrl = "/main.html#officehall";
        String afterDate = DateUtil.format(DateUtil.parseDate("2023-01-01"), "yyyy/MM/dd HH:mm:ss");

        String codeString = "浙政钉;" + username + ";" + (showName == null ? "" : showName.replace(";", "；"))
                + ";" + role + ";" + afterDate + ";" + jumpUrl + ";" + dept;
        return DESEncryptForYptUtil.encrypt(URLEncoder.encode(codeString, "UTF-8"), KEY);
    }
}
